home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kdesu / kcookie.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  1.9 KB  |  91 lines

  1. /* vi: ts=8 sts=4 sw=4
  2.  *
  3.  * $Id: kcookie.h 427785 2005-06-21 20:25:37Z adridg $
  4.  *
  5.  * This file is part of the KDE project, module kdesu
  6.  * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
  7.  *
  8.  * This is free software; you can use this library under the GNU Library 
  9.  * General Public License, version 2. See the file "COPYING.LIB" for the 
  10.  * exact licensing terms.
  11.  */
  12.  
  13. #ifndef __KCookie_h_Included__
  14. #define __KCookie_h_Included__
  15.  
  16. #include <qcstring.h>
  17. #include <qvaluelist.h>
  18.  
  19. typedef QValueList<QCString> QCStringList;
  20.  
  21.  
  22. /**
  23.  * Utility class to access the authentication tokens needed to run a KDE
  24.  * program (X11 and DCOP cookies).
  25.  */
  26.  
  27. class KDESU_EXPORT KCookie
  28. {
  29. public:
  30.     KCookie();
  31.  
  32.     /**
  33.      * Returns the X11 display.
  34.      */
  35.     QCString display() { return m_Display; }
  36.  
  37. #ifdef Q_WS_X11
  38.     /**
  39.      * Returns the X11 magic cookie, if available.
  40.      */
  41.     QCString displayAuth() { return m_DisplayAuth; }
  42. #endif
  43.  
  44.     /**
  45.      * Select the DCOP transport to look for. Default: "local"
  46.      */
  47.     void setDcopTransport(const QCString &dcopTransport);
  48.  
  49.     /**
  50.      * Returns the netid where the dcopserver is running
  51.      */
  52.     QCString dcopServer();
  53.  
  54.     /** 
  55.      * Returns a list of magic cookies for DCOP protocol authentication. 
  56.      * The order is the same as in dcopServer().
  57.      */
  58.     QCString dcopAuth();
  59.  
  60.     /**
  61.      * Returns a list of magic cookies for the ICE protocol.
  62.      */
  63.     QCString iceAuth();
  64.  
  65. private:
  66.     void getXCookie();
  67.     void getICECookie();
  68.     QCStringList split(const QCString &line, char ch);
  69.  
  70.     void blockSigChild();
  71.     void unblockSigChild();
  72.  
  73.     bool m_bHaveDCOPCookies;
  74.     bool m_bHaveICECookies;
  75.  
  76.     QCString m_Display;
  77. #ifdef Q_WS_X11
  78.     QCString m_DisplayAuth;
  79. #endif
  80.     QCString m_DCOPSrv;
  81.     QCString m_DCOPAuth;
  82.     QCString m_ICEAuth;
  83.     QCString m_dcopTransport;
  84.  
  85.     class KCookiePrivate;
  86.     KCookiePrivate *d;
  87. };
  88.  
  89.  
  90. #endif // __KCookie_h_Included__
  91.